 var url =window.location.search; //获取url中"?"符后的字串 
var theRequest = new Object(); 
var token;
var phoneNum;
/*if (url.indexOf("?") != -1) {
       var str = url.substr(1); 
         strs = str.split("&"); 
		for(var i = 0; i < strs.length; i ++) { 
			theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]); 
		}  
		 token=theRequest.token;
		 phoneNum=theRequest.phoneNum;
		 localStorage.setItem("phoneNum",phoneNum);
		 localStorage.setItem("token",token);
}*/
    var paramStr = {};	
    paramStr.phoneNum=localStorage.getItem("phoneNum");
    paramStr.token=localStorage.getItem("token");	
//  console.log(localStorage.getItem("token"));
    var params = {};	
    params.paramStr = JSON.stringify(paramStr);	

	function jump(){
		var result;
		$.ajax({
			headers: {"phone":phoneNum,"token":token},
	        method: "POST",
	        data:params,
	        url:'/fenful/api/v1/user/getUser',
	        datatype: "json",
	        success: function(re) { 
//	        	console.log(re.data);            	
	        },
	        error: function(re) {
	          result=re;
	          
	        }
	    }) 
	   return result;
	   
	}

     var links = document.querySelectorAll('a')	   
     Array.prototype.forEach.call(links, function (link) {
     	phoneNum=localStorage.getItem("phoneNum");
     	token=localStorage.getItem("token");
        link.addEventListener('click', function (e) {           	
            if(token&&phoneNum){           	 
            	 window.location.href=this.href;          	         	           
            }else{
            	e.preventDefault();
            	window.location.href="/h5/#/login?wzl"; 
            }                  
        })
    })
     

